Skip to main content

How to Add Checkpoints to Long-Running Agents

Guide · about 8 min · refs checked 2026-11-19 (reference links and dates only)

Long jobs are not afraid of being slow; they are afraid of one bad step forcing a full restart. Checkpoints design recoverability into the flow.

How to
Cut the job into verifiable stages, each with a clear artefact and success condition; “keep going” is not a stage. At the end of each stage write structured state: goal, done, not done, key decisions, external IDs, spend. Checkpoint before side effects (send, order, edit a file), so a failure knows what was and was not done. On resume, read the state before acting; never guess progress from chat history. Set maximum steps, budget and time; stop and ask a human when exceeded. Do not retry forever. Keep a list of irreversible actions; on resume, do not replay by default — verify external state first.

Example and interpretation

A teaching scenario, not a measured or executed site test.

Split "triage 20 customer emails and draft replies" into read, classify, draft and approve. After each stage write one state line: how many processed, what needs confirmation, tokens spent. Kill the process midway; on resume read the state first and never resend approved mail.

How to check your practice

Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.

For this topic, start with concept confusion · See all six scenarios and their reasoning

Sources
  • Anthropic · Building effective agents ↗
  • LangGraph · Persistence concepts ↗
  • Learn AI · Long-running tasks ↗